import React, { FC } from 'react';
import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom';
import { Utils } from 'lfun-bg-comp';
import { Spin } from 'antd';
import AuthRoute from '@/router/auth-route';
import { getPathRoot } from '@/utils';

const RedriectPage = React.lazy(() => import('@/component/redriect-page'));

// 教育单位管理
const Home = React.lazy(() => import('@/view/home'));
const NotFound = React.lazy(() => import('@/view/exception/404'));
const Planning = React.lazy(() => import('@/view/unit/planning'));
const PlanningChange = React.lazy(() => import('@/view/unit/planning/change'));
const PlanningEdit = React.lazy(() => import('@/view/unit/planning/edit'));
const PlanningDetails = React.lazy(() => import('@/view/unit/planning/details'));
const PlanningAssets = React.lazy(() => import('@/view/unit/planning/assets'));
const PlanningAudit = React.lazy(() => import('@/view/unit/planning/audit'));
const PlanningAuditDetails = React.lazy(() => import('@/view/unit/planning/audit-details'));

const School = React.lazy(() => import('@/view/unit/school'));
const SchoolEdit = React.lazy(() => import('@/view/unit/school/edit'));
const SchoolChange = React.lazy(() => import('@/view/unit/school/change'));
const SchoolDetails = React.lazy(() => import('@/view/unit/school/details'));
const SchoolAudit = React.lazy(() => import('@/view/unit/school/audit'));
const SchoolAuditDetails = React.lazy(() => import('@/view/unit/school/audit-details'));

const ConfigGrade = React.lazy(() => import('@/view/unit/configs/grade'));
const ConfigNewGrade = React.lazy(() => import('@/view/unit/configs/newGrade'));
const ConfigClass = React.lazy(() => import('@/view/unit/configs/classAuth'));
const classSchool = React.lazy(() => import('@/view/unit/configs/class'));
const ConfigCourse = React.lazy(() => import('@/view/unit/configs/course'));
const yangyong1 = React.lazy(() => import('@/view/unit/configs/yangyong1'));
const certification1 = React.lazy(() => import('@/view/unit/configs/certification1'));
const certification2 = React.lazy(() => import('@/view/unit/configs/certification2'));
const certification2Edit = React.lazy(() => import('@/view/unit/configs/certification2Edit'));
const certification3 = React.lazy(() => import('@/view/unit/configs/certification3'));
const certification4 = React.lazy(() => import('@/view/unit/configs/certification4'));
const certification4Add = React.lazy(() => import('@/view/unit/configs/certification4Add'));

const class2 = React.lazy(() => import('@/view/unit/configs/class2'));
const class3 = React.lazy(() => import('@/view/unit/configs/class3'));
const class4 = React.lazy(() => import('@/view/unit/configs/class4'));
const profession = React.lazy(() => import('@/view/unit/configs/profession'));
const unitinfor = React.lazy(() => import('@/view/unit/unitinfor/index'));

const ConfigMajor = React.lazy(() => import('@/view/unit/configs/major'));
const OrgMg = React.lazy(() => import('@/view/unit/org'));
const OrgMgClass = React.lazy(() => import('@/view/unit/org/orgMgClass/index'));
const SubjectMg = React.lazy(() => import('@/view/unit/configs/subject'));
const SYInstitution = React.lazy(() => import('@/view/unit/other'));
const XZInstitution = React.lazy(() => import('@/view/unit/other'));
const InstitutionEdit = React.lazy(() => import('@/view/unit/other/edit'));
const InstitutionDetail = React.lazy(() => import('@/view/unit/other/details'));
const InstitutionAudit = React.lazy(() => import('@/view/unit/other/audit'));
const InstitutionDetails = React.lazy(() => import('@/view/unit/other/audit-details'));

// 资产管理
const assetManage = React.lazy(() => import('@/view/unit/asset-manage'));
// 校舍管理
const schoolHouse = React.lazy(() => import('@/view/unit/school-house'));

// 教师管理
const TchrOnboarding = React.lazy(() => import('@/view/teacher/onboarding/index')); // 1
const TchrOnboardingEdit = React.lazy(() => import('@/view/teacher/onboarding/edit'));
const TchrOnboardingDetails = React.lazy(() => import('@/view/teacher/onboarding/details'));
const TchrOnboardingRestDetails = React.lazy(() => import('@/view/teacher/onboarding/restDetails'));
const TchrNewApprove = React.lazy(() => import('@/view/teacher/onboarding/approve'));
const TchrNewApproveDetails = React.lazy(() => import('@/view/teacher/onboarding/approve/details'));
const TchrNewApproveAudit = React.lazy(() => import('@/view/teacher/onboarding/approve/audit'));
const TchrEmployed = React.lazy(() => import('@/view/teacher/employed')); // 2
const TchrEmployedDetails = React.lazy(() => import('@/view/teacher/employed/details'));
const TchrEmployedChange = React.lazy(() => import('@/view/teacher/employed/change'));
const TchrEmployedTransferOut = React.lazy(() => import('@/view/teacher/employed/transferout'));
const TchrEmployedTransferInOp = React.lazy(() => import('@/view/teacher/employed/transferin-op'));
const TchrApprove = React.lazy(() => import('@/view/teacher/employed/approve'));
const TchrApproveDetails = React.lazy(() => import('@/view/teacher/employed/approve/details'));
const TchrApproveAudit = React.lazy(() => import('@/view/teacher/employed/approve/audit'));
const TchrWorkChange = React.lazy(() => import('@/view/teacher/employed/workchange'));
const TchrSysConfig = React.lazy(() => import('@/view/teacher/sys/config'));
// const TchrSysTask = React.lazy(() => import('@/view/teacher/sys/task'));
const TchrTransferinApprove = React.lazy(() => import('@/view/teacher/employed/transferin-approve'));
const TchrBorrowOut = React.lazy(() => import('@/view/teacher/employed/borrowout'));
const TchrEmployedBorrowInOp = React.lazy(() => import('@/view/teacher/employed/borrowin-op'));
const TchrBorrowinApprove = React.lazy(() => import('@/view/teacher/employed/borrowin-approve'));
// const TchrNonemployedRetire = React.lazy(() => import('@/view/teacher/nonemployed/retire'));
const TchrNonemployedRetireDetails = React.lazy(() => import('@/view/teacher/nonemployed/details'));
// 教师 教职工变动管理 - 借动 - 调动 - 其他
const TchrAlterationBorrowing = React.lazy(() => import('@/view/teacher/alteration/borrowing'));
const TchrAlterationBorrowingIn = React.lazy(() => import('@/view/teacher/employed/borrowin-in'));
const TchrAlterationBorrowingOut = React.lazy(() => import('@/view/teacher/employed/borrowin-out'));
const TchrAlterationTransfer = React.lazy(() => import('@/view/teacher/alteration/transfer'));
const TchrAlterationTransferIn = React.lazy(() => import('@/view/teacher/employed/transferin-in'));
const TchrAlterationTransferOut = React.lazy(() => import('@/view/teacher/employed/transferin-out'));
const TchrAlterationOther = React.lazy(() => import('@/view/teacher/alteration/other'));
const TchrAlterationOtherCreate = React.lazy(() => import('@/view/teacher/employed/workchange-create'));
const TchrAlterationOtherDetails = React.lazy(() => import('@/view/teacher/employed/workchange-detail'));
// 教师 非在职教职工管理 - 离退休 - 非离退休
const TchrNonemployedRetire = React.lazy(() => import('@/view/teacher/nonemployed/retire/index'));
const TchrNonemployedRetireRetirement = React.lazy(() => import('@/view/teacher/nonemployed/retire/retirement'));
const TchrNonemployedRetireReEmploy = React.lazy(() => import('@/view/teacher/nonemployed/retire/re-employ'));
const TchrNonemployedNoretire = React.lazy(() => import('@/view/teacher/nonemployed/noretire'));
const TchrNonemployedNoretireReinstatement = React.lazy(
  () => import('@/view/teacher/nonemployed/noretire/reinstatement')
);
// 教师 审核
const TchrAudit = React.lazy(() => import('@/view/teacher/audit'));
// 教师 系统管理 - 日志 - 任务 - 信息
const TchrSysLog = React.lazy(() => import('@/view/teacher/sys/log'));
const TchrSysTask = React.lazy(() => import('@/view/teacher/sys/task/index'));
const TchrSysInfo = React.lazy(() => import('@/view/teacher/sys/info'));

// 学生管理
const StuNewStudent = React.lazy(() => import('@/view/student/newStu'));
const StuNewStudentDetails = React.lazy(() => import('@/view/student/newStu/details'));
const StuNewStudentEdit = React.lazy(() => import('@/view/student/newStu/edit'));
const StuNowStudent = React.lazy(() => import('@/view/student/nowStu'));
const StuClassroom = React.lazy(() => import('@/view/student/newStu/classroom'));
const StuAcademia = React.lazy(() => import('@/view/student/newStu/academia'));
const StuInStudent = React.lazy(() => import('@/view/student/inStu'));
const StuInStudentCheckIn = React.lazy(() => import('@/view/student/inStu/checkIn'));
const StuInStudentCheckOut = React.lazy(() => import('@/view/student/inStu/checkOut'));
const StuInStudentDetails = React.lazy(() => import('@/view/student/inStu/details'));
const StuGraduation = React.lazy(() => import('@/view/student/graduation'));
const StuGraduationCounty = React.lazy(() => import('@/view/student/graduation/county'));
const StuAudit = React.lazy(() => import('@/view/student/audit'));
const Graduate = React.lazy(() => import('@/view/student/notinstudent/graduate'));
const StuOther = React.lazy(() => import('@/view/student/notinstudent/other'));

const StuGraduationDetails = React.lazy(() => import('@/view/student/graduation/details'));
const StuInStudentTransfer = React.lazy(() => import('@/view/student/inStu/transfer'));
const StuInStudentTransferApprove = React.lazy(() => import('@/view/student/inStu/transferApprove'));
const StuInStudentTransferView = React.lazy(() => import('@/view/student/inStu/transferView'));
const StuInStudentTransferView2 = React.lazy(() => import('@/view/student/inStu/transferView2'));
const StuInStudentInnerTransfer = React.lazy(() => import('@/view/student/inStu/innerTransfer'));
const StuInEmporaryBorrowingList = React.lazy(() => import('@/view/student/inStu/emporaryBorrowingList'));
const StuInEmporaryBorrowing = React.lazy(() => import('@/view/student/inStu/emporaryBorrowing'));
const StuDiplomaBatch = React.lazy(() => import('@/view/student/diploma/batch'));
const StuDiplomaTemplate = React.lazy(() => import('@/view/student/diploma/template'));
const StuDiplomaCertificate = React.lazy(() => import('@/view/student/diploma/certificate'));
const StuDiplomaCompany = React.lazy(() => import('@/view/student/diploma/company'));

const Oauth2Callback = React.lazy(() => import('@/component/oauth2/callback'));
// // 管理页面
// const PublicMg = React.lazy(() => import('@/view/mg/public'));
// const AgencyMg = React.lazy(() => import('@/view/mg/agency'));

const getUnit = () => {
  const isSchool = Utils.getProps('isSchool');

  return (
    <>
      <Route index element={<AuthRoute component={RedriectPage} />} />
      {/* 配置管理 */}
      <Route path="course" element={<AuthRoute component={ConfigCourse} />} />
      <Route path="class" element={<AuthRoute component={ConfigCourse} />} />

      <Route path="course1" element={<AuthRoute component={certification1} />} />
      <Route path="course2" element={<AuthRoute component={certification2} />} />
      <Route path="course2/edit/:id" element={<AuthRoute component={certification2Edit} />} />
      <Route path="course3" element={<AuthRoute component={certification3} />} />
      <Route path="course4" element={<AuthRoute component={certification4} />} />
      <Route path="course4Add" element={<AuthRoute component={certification4Add} />} />
      <Route path="course5" element={<AuthRoute component={class3} />} />
      <Route path="course6" element={<AuthRoute component={class2} />} />
      <Route path="course7" element={<AuthRoute component={class4} />} />
      <Route path="course8" element={<AuthRoute component={profession} />} />
      <Route path="course9" element={<AuthRoute component={assetManage} />} />
      <Route path="course112" element={<AuthRoute component={unitinfor} />} />

      <Route path="major" element={<AuthRoute component={ConfigMajor} />} />
      <Route path="grade" element={<AuthRoute component={ConfigNewGrade} />} />
      {/* <Route path="newGrade" element={<AuthRoute component={ConfigNewGrade} />} /> */}
      <Route path="class" element={<AuthRoute component={ConfigClass} />} />
      <Route path="class/details/:school_id" element={<AuthRoute component={classSchool} />} />
      <Route path="subject" element={<AuthRoute component={SubjectMg} />} />
      {/* 教育单位管理（规划） */}
      <Route path="planning" element={<AuthRoute component={Planning} />} />
      <Route path="planning/edit/:id" element={<AuthRoute component={PlanningEdit} />} />
      <Route path="planning/edit/:id" element={<AuthRoute component={PlanningAssets} />} />
      <Route path="planning/details/:id" element={<AuthRoute component={PlanningDetails} />} />
      <Route path="planning/change/:id" element={<AuthRoute component={PlanningChange} />} />

      <Route path="planning-audit/openschool" element={<AuthRoute component={PlanningAudit} />} />
      <Route path="planning-audit/openschool/details/:id" element={<AuthRoute component={PlanningAuditDetails} />} />
      <Route path="planning-audit/closeschool" element={<AuthRoute component={PlanningAudit} />} />
      <Route path="planning-audit/closeschool/details/:id" element={<AuthRoute component={PlanningAuditDetails} />} />
      <Route path="planning-audit/changekeyinfo" element={<AuthRoute component={PlanningAudit} />} />
      <Route path="planning-audit/changekeyinfo/details/:id" element={<AuthRoute component={PlanningAuditDetails} />} />
      {/* 教育单位管理（学校） */}
      <Route path="school" element={<AuthRoute component={School} />} />
      <Route path="school/edit/:id" element={<AuthRoute component={SchoolEdit} />} />
      <Route path="school/details/:id" element={<AuthRoute component={SchoolDetails} />} />
      <Route path="school/change/:id" element={<AuthRoute component={SchoolChange} />} />

      <Route path="school-audit/openschool" element={<AuthRoute component={SchoolAudit} />} />
      <Route path="school-audit/openschool/details/:id" element={<AuthRoute component={SchoolAuditDetails} />} />
      <Route path="school-audit/closeschool" element={<AuthRoute component={SchoolAudit} />} />
      <Route path="school-audit/closeschool/details/:id" element={<AuthRoute component={SchoolAuditDetails} />} />
      <Route path="school-audit/changekeyinfo" element={<AuthRoute component={SchoolAudit} />} />
      <Route path="school-audit/changekeyinfo/details/:id" element={<AuthRoute component={SchoolAuditDetails} />} />
      {/* 组织管理 */}
      {isSchool && <Route path="org" element={<AuthRoute component={OrgMg} />} />}
      {!isSchool && <Route path="org" element={<AuthRoute component={OrgMgClass} />} />}
      <Route path="org/details/:id" element={<AuthRoute component={OrgMg} />} />
      {/* 资产管理 */}
      <Route path="asset-manage" element={<AuthRoute component={assetManage} />} />
      {/* 校舍管理 */}
      <Route path="school-house" element={<AuthRoute component={schoolHouse} />} />
      {/* 行政事业单位管理 */}
      <Route path="institution">
        <Route index element={<Navigate to={`${getPathRoot()}/institution/sy`} />} />
        <Route path="sy" element={<AuthRoute component={SYInstitution} />} />
        <Route path="xz" element={<AuthRoute component={XZInstitution} />} />
        <Route path="sy/change/:id" element={<AuthRoute component={InstitutionEdit} />} />
        <Route path="xz/change/:id" element={<AuthRoute component={InstitutionEdit} />} />
        <Route path="sy/details/:id" element={<AuthRoute component={InstitutionDetail} />} />
        <Route path="xz/details/:id" element={<AuthRoute component={InstitutionDetail} />} />
      </Route>
      <Route path="institution-audit/open" element={<AuthRoute component={InstitutionAudit} />} />
      <Route path="institution-audit/close" element={<AuthRoute component={InstitutionAudit} />} />
      <Route path="institution-audit/changekeyinfo" element={<AuthRoute component={InstitutionAudit} />} />
      <Route path="institution-audit/close/details/:id" element={<AuthRoute component={InstitutionDetails} />} />
      <Route path="institution-audit/open/details/:id" element={<AuthRoute component={InstitutionDetails} />} />

      <Route
        path="institution-audit/changekeyinfo/details/:id"
        element={<AuthRoute component={InstitutionDetails} />}
      />

      <Route
        path="institution-audit/changekeyinfo/details/:id"
        element={<AuthRoute component={SchoolAuditDetails} />}
      />
    </>
  );
};

const getStudent = () => {
  return (
    <>
      <Route index element={<AuthRoute component={RedriectPage} />} />
      <Route path="newstudent" element={<AuthRoute component={StuNewStudent} />} />
      <Route path="newstudent/details/:id" element={<AuthRoute component={StuNewStudentDetails} />} />
      <Route path="newstudent/edit/:id" element={<AuthRoute component={StuNewStudentEdit} />} />
      <Route path="newstudent/classroom" element={<AuthRoute component={StuClassroom} />} />
      <Route path="newstudent/academia" element={<AuthRoute component={StuAcademia} />} />
      <Route path="nowstudent" element={<AuthRoute component={StuNowStudent} />} />
      <Route path="instudent" element={<AuthRoute component={StuInStudent} />} />
      <Route path="instudent/checkin" element={<AuthRoute component={StuInStudentCheckIn} />} />
      <Route path="instudent/checkout" element={<AuthRoute component={StuInStudentCheckOut} />} />
      <Route path="instudent/details/:id" element={<AuthRoute component={StuInStudentDetails} />} />
      <Route path="instudent/transfer" element={<AuthRoute component={StuInStudentTransfer} />} />
      <Route path="instudent/transfer/approve/:id" element={<AuthRoute component={StuInStudentTransferApprove} />} />
      <Route path="instudent/transfer/view/:id" element={<AuthRoute component={StuInStudentTransferView} />} />
      <Route path="instudent/transfer/view2/:id" element={<AuthRoute component={StuInStudentTransferView2} />} />
      <Route path="instudent/innerTransfer" element={<AuthRoute component={StuInStudentInnerTransfer} />} />
      <Route path="instudent/emporaryBorrowing" element={<AuthRoute component={StuInEmporaryBorrowingList} />} />
      <Route path="instudent/emporaryBorrowing/:id" element={<AuthRoute component={StuInEmporaryBorrowing} />} />
      <Route path="notinstudent">
        <Route path="graduate" element={<AuthRoute component={Graduate} />} />
        <Route path="other" element={<AuthRoute component={StuOther} />} />
      </Route>
      <Route path="stuaudit" element={<AuthRoute component={StuAudit} />} />
      <Route path="graduation" element={<AuthRoute component={StuGraduation} />} />
      <Route path="graduation/country" element={<AuthRoute component={StuGraduationCounty} />} />
      <Route path="graduation/details/:id" element={<AuthRoute component={StuGraduationDetails} />} />
      {/* 制证 */}
      <Route path="diploma">
        <Route path="batch" element={<AuthRoute component={StuDiplomaBatch} />} />
        <Route path="template" element={<AuthRoute component={StuDiplomaTemplate} />} />
        <Route path="certificate" element={<AuthRoute component={StuDiplomaCertificate} />} />
        <Route path="company" element={<AuthRoute component={StuDiplomaCompany} />} />
      </Route>
    </>
  );
};

const getTeacher = () => {
  return (
    <>
      <Route index element={<AuthRoute component={RedriectPage} />} />
      <Route path="onboarding" element={<AuthRoute component={TchrOnboarding} />} />
      <Route path="onboarding/edit/:id" element={<AuthRoute component={TchrOnboardingEdit} />} />
      <Route path="onboarding/details/:id" element={<AuthRoute component={TchrOnboardingDetails} />} />
      <Route path="onboarding/restdetails/:id" element={<AuthRoute component={TchrOnboardingRestDetails} />} />
      <Route path="onboarding/approve" element={<AuthRoute component={TchrNewApprove} />} />
      <Route path="onboarding/approve/details/:id" element={<AuthRoute component={TchrNewApproveDetails} />} />
      <Route path="onboarding/approve/audit/:id" element={<AuthRoute component={TchrNewApproveAudit} />} />
      <Route path="employed" element={<AuthRoute component={TchrEmployed} />} />
      <Route path="employed/details/:id" element={<AuthRoute component={TchrEmployedDetails} />} />
      <Route path="employed/change/:id" element={<AuthRoute component={TchrEmployedChange} />} />
      <Route path="employed/approve" element={<AuthRoute component={TchrApprove} />} />
      <Route path="employed/approve/details/:id" element={<AuthRoute component={TchrApproveDetails} />} />
      <Route path="employed/approve/audit/:id" element={<AuthRoute component={TchrApproveAudit} />} />
      <Route path="employed/edit/:id" element={<AuthRoute component={TchrOnboardingEdit} />} />
      <Route path="employed/workchange" element={<AuthRoute component={TchrWorkChange} />} />
      <Route path="trchsys/config" element={<AuthRoute component={TchrSysConfig} />} />
      <Route path="trchsys/task" element={<AuthRoute component={TchrSysTask} />} />

      <Route path="employed/transferout" element={<AuthRoute component={TchrEmployedTransferOut} />} />
      <Route path="employed/transferin" element={<AuthRoute component={TchrTransferinApprove} />} />
      <Route path="employed/transferin/:id" element={<AuthRoute component={TchrEmployedTransferInOp} />} />

      <Route path="employed/borrowout" element={<AuthRoute component={TchrBorrowOut} />} />
      <Route path="employed/borrowin/:id" element={<AuthRoute component={TchrEmployedBorrowInOp} />} />
      <Route path="employed/borrowin" element={<AuthRoute component={TchrBorrowinApprove} />} />

      {/* <Route path="nonemployed/retire" element={<AuthRoute component={TchrNonemployedRetire} />} /> */}
      <Route path="nonemployed/details/:id" element={<AuthRoute component={TchrNonemployedRetireDetails} />} />

      {/* 教职工变动 */}
      <Route path="alteration/borrowing" element={<AuthRoute component={TchrAlterationBorrowing} />} />
      <Route path="alteration/borrowing/in/:id" element={<AuthRoute component={TchrAlterationBorrowingIn} />} />
      <Route path="alteration/borrowing/out/:id" element={<AuthRoute component={TchrAlterationBorrowingOut} />} />
      <Route path="alteration/transfer" element={<AuthRoute component={TchrAlterationTransfer} />} />
      <Route path="alteration/transfer/in/:id" element={<AuthRoute component={TchrAlterationTransferIn} />} />
      <Route path="alteration/transfer/out/:id" element={<AuthRoute component={TchrAlterationTransferOut} />} />
      <Route path="alteration/other" element={<AuthRoute component={TchrAlterationOther} />} />
      <Route path="alteration/other/create" element={<AuthRoute component={TchrAlterationOtherCreate} />} />
      <Route path="alteration/other/details/:type" element={<AuthRoute component={TchrAlterationOtherDetails} />} />
      {/* 非在职教职工 */}
      <Route path="nonemployed/retire" element={<AuthRoute component={TchrNonemployedRetire} />} />
      <Route path="nonemployed/retire/retirement" element={<AuthRoute component={TchrNonemployedRetireRetirement} />} />
      <Route
        path="nonemployed/retire/reemploy/:type"
        element={<AuthRoute component={TchrNonemployedRetireReEmploy} />}
      />
      <Route path="nonemployed/noretire" element={<AuthRoute component={TchrNonemployedNoretire} />} />
      <Route
        path="nonemployed/noretire/reinstatement/:type"
        element={<AuthRoute component={TchrNonemployedNoretireReinstatement} />}
      />
      {/* 审核 */}
      <Route path="audit" element={<AuthRoute component={TchrAudit} />} />
      {/* 系统 */}
      <Route path="trchsys/log" element={<AuthRoute component={TchrSysLog} />} />
      <Route path="trchsys/task" element={<AuthRoute component={TchrSysTask} />} />
      <Route path="trchsys/info" element={<AuthRoute component={TchrSysInfo} />} />
    </>
  );
};

// const getMg = () => {
//   return (
//     <>
//       {/* <Route index element={<AuthRoute component={PublicMg} />} />
//       <Route path="public" element={<AuthRoute component={PublicMg} />} />
//       <Route path="agency" element={<AuthRoute component={AgencyMg} />} /> */}
//     </>
//   );
// };

const App: FC = () => {
  return (
    <React.Suspense
      fallback={
        <Spin
          style={{
            fontSize: 24,
            position: 'absolute',
            left: '50%',
            top: '50%',
            transform: 'translate(-50%, -50%)',
          }}
        />
      }
    >
      <Router>
        <Routes>
          <Route path="/" element={<Home />} />
          <Route path="/auth/oauth2/callback/:code" element={<Oauth2Callback />} />
          {/* 教师 */}
          <Route path="city/:code/teacher/:type">{getTeacher()}</Route>
          <Route path="county/:county_code/teacher/:type">{getTeacher()}</Route>
          <Route path=":school_id/teacher">{getTeacher()}</Route>
          <Route path="planning_school/:school_id/teacher">{getTeacher()}</Route>
          {/* 学生管理 */}
          <Route path="city/:code/student/:type">{getStudent()}</Route>
          <Route path="county/:county_code/student/:type">{getStudent()}</Route>
          <Route path=":school_id/student">{getStudent()}</Route>
          <Route path="planning_school/:school_id/student">{getStudent()}</Route>
          {/* 单位管理 */}
          <Route path="city/:code/unit/:type">{getUnit()}</Route>
          <Route path="county/:county_code/unit/:type">{getUnit()}</Route>
          <Route path=":school_id/unit">{getUnit()}</Route>
          <Route path="planning_school/:school_id/unit">{getUnit()}</Route>
          {/* <Route path="city/mg">{getMg()}</Route>
          <Route path="county/:county_code/mg">{getMg()}</Route>
          <Route path="school/:school_id/mg">{getMg()}</Route> */}

          <Route path="*" element={<NotFound />} />
        </Routes>
      </Router>
    </React.Suspense>
  );
};

export default App;
